Python Hex
hex also implemented in
Ruby
The goal in hex is simple. Red moves first, and each player alternates placing stones anywhere
on the board. Red tries to form an unbroken chain of stones between top and bottom, blue
between left and right. The first player to achieve an unbroken chain wins. Ties are
mathematically impossible. While the rules are simple, the strategy is
complex.
I have implemented an internet two-player hex game in the
Python
programming language. It uses
Jabber, an open XML-based messaging system.
Several steps are needed to set up this program:
- Download a
Jabber client,
and use it to create a Jabber account. Recommend
JabberFox
on Mac OS X. Create 2 accounts if you want to converse with your opponent using
Jabber instant messaging during the game (Hex gets very confused if more than one
conversation is going on with the same user name...).
- Download Python. On Mac OS X use
Fink
to install Python (WITH TK SUPPORT) and
XDarwin. Yes, this is painful.
- Download
jabber.py Jabber connectivity library for Python.
- Download
hex.tar.
Untar it.
- From a terminal command prompt in the hex directory, type python hex.py yourUsername yourPassword opponentUsername
- disclaimers: currently the application does not detect victory, must be restarted
after each game, and does not handle network errors gracefully...
- Python Hex has been tested on Mac OS X (Windows & Linux test not done yet). Have Fun.
- and if anyone knows why Fink OS X XDarwin Python generates a Bus Error whenever more than one Tk application is run at the same time, I'd like to know...
Copyright (c) 2002 Eric Rollins
Hex comes with Absolutely No Warranty.
This is free software, and you are welcome to
redistribute it under certain conditions
(for details see:GNU General Public License,
http://www.gnu.org/copyleft/gpl.html)